
<?php

class CResumeServicesTable
{

public static $instance; 



 function DrawTable($title,$table,$growtable,$campos,$id)//obligatorio ID como campo inicial
    {
    
    //$qu = "Select `idActPaxtour`, `DesSer`, `CanIteRec`, `PriUni`, `CommSer` from actividades_has_tour_has_pasajero where SerFlag=1 and operador_idOpe=$id" ;

    $query = "SELECT  `actividades`.`NomAct` ,  `actividades`.`DescAct` ,  `actividades`.`idAct` ,  `actividades`.`PlaceAct` ,  `actividades_has_tour_has_pasajero`.`DesSer` , `actividades_has_tour_has_pasajero`.`PriUni` ,  `actividades_has_tour_has_pasajero`.`actividades_idAct` 
    FROM actividades LEFT JOIN  `actividades_has_tour_has_pasajero` ON  `actividades`.`idAct` =  `actividades_has_tour_has_pasajero`.`actividades_idAct` 
    WHERE ((operador_idOpe = '$id' AND SerFlag ='1'))";


     echo "<div id='content_area_user_title'>";
    echo "<h2> $title</h2>";
    echo "</div>";


    echo	"<form>";						
    echo "<form id='filter-form'>Filtrar servicio: <input name='filter' id='filter' value='' maxlength='30' size='30' type='text'></form><br>";
    echo "</form>";
   
   
   
       echo "<div class='usersettings_statistics'>"; 
 


    echo "<table class='food_planner'>";
    
    echo "<thead>";
    echo "<tr>";    
        foreach($campos as $id=>$valor){
                echo "<th>$valor</th>";
                }
                echo "<th>E</th>";
                echo "<th>X</th>";
    echo "</tr>";    
    echo "</thead>";
    
    echo "<tbody><tr style='display: table-row;'>";
    
     //echo "<table> <tbody>";

 echo "<tr class='odd'>";
 
    
    // $qu="select*from $table";
    $table=CModelo::getInstance()->getData($query);
//var_dump($table);
    $cont=0;
    $ruta=CConfig::getInstance()->rutalocal;
    
    
    foreach($table as $campo => $valor)
    { 



$cont=$cont+1;
if($cont%2){




echo "<tr class='odd'>";
$i="";$cont=0;
foreach($valor as $id=>$val)
{ if($cont==0){$i=$val;}

echo "<td>$val</td>";$cont=$cont+1;
}
/*---------------------------------------------------------------------------*/
// las referencias debbden de ser modificadas deacuerdo al directorio
//
/*---------------------------------------------------------------------------*/



//echo "<t  d> <a href='$ruta/MDTourGeneral/CTourEdit.php?codigo=$i'>$numpaxa[0]</a>  </td>";


//echo "<td> <input type=button onClick=\"parent.location='$ruta/MDItinerary/MDEItinerary.php?codigo=$i'\" value='Buscar tour'>  </td>";


echo "<td> <a href='CEditRestaurantes.php?codigo=$i'> <img src='../../MDTour/images/edit.png' width='32' title='Editar restaurante $i'/></a> </td>";
echo "<td><a href='/edson1/modificar.php?codigo=$i'> <img src='../../MDTour/images/trash.png' width='32' title='Eliminar restaurante $i'/> </a> </td>";
echo "</tr>";
}
else
{

echo "<tr class='even'> ";
$i2="";$cont2=0;
foreach($valor as $id => $val)
{ if($cont2==0){$i2=$val;}
echo "<td>$val </td>";$cont2=$cont2+1;
}

//echo "<td> <input type=button onClick=\"parent.location='$ruta/MDItinerary/MDEItinerary.php?codigo=$i2'\" value='Buscar tours'>  </td>";
echo "<td> <a href='CEditRestaurantes.php?codigo=$i2'> <img src='../../MDTour/images/edit.png' width='32' title='Editar restaurante $i2'/></a> </td>";
echo "<td><a href='/edson1/modificar.php?codigo=$i2'> <img src='../../MDTour/images/trash.png' width='32' title='Eliminar restaurante $i2'/> </a> </td>";
echo "</tr>";
}

}
echo "</td></tr></tbody></table><br><br></form>";


echo "</div>";

} 


public static function getInstance()
	{
		//echo "<div id=register-box>";
        if(self::$instance==null)
		  self::$instance=new CResumeServicesTable();
	//   echo "</div>";	  
		return  self::$instance;
	   
    
    }	


}
?>